<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>图书管理</title>
  <link rel="stylesheet" href="/static/css/booklist.css">
</head>
<body>
<div class="container">
  <div class="sidebar">
    <a href="/managerlist">用户查看</a>
    <a href="#" class="active">图书管理</a>
  </div>
  <div class="main-content">
    <div style="text-align: center">
      <span style="color: darkslategray; font-size: 20px"><h1>基于springboot的书籍管理平台</h1></span>

      <div>
        <form action="/managerbooklist">
          <input type="text" name="title" th:value="${title}" placeholder="请输入书名"/>
          <input type="text" name="author" th:value="${author}" placeholder="请输入作者"/>
          <input type="submit" value="查询"/>
        </form>
      </div>
      <br>
      <table class="list">
        <tr>
          <th>编号</th>
          <th>书名</th>
          <th>作者</th>
          <th>出版日期</th>
          <th>操作</th>
        </tr>
        <tr th:each="book : ${bookpageInfo.getList()}">
          <td th:text="${book.id}">0</td>
          <td th:text="${book.title}">示例书名</td>
          <td th:text="${book.author}">示例作者</td>
          <td th:text="${#dates.format(book.publish_date, 'yyyy-MM-dd')}">日期</td>
          <td>
            <a th:href="@{'/managerbookupdatePage/'+${book.id}}">更改</a>
            <a th:href="@{'/managerbookdelete/'+${book.id}}">删除</a>
          </td>
        </tr>
      </table>
      <!--分页的前端-->
      <div style="text-align: center;margin-top:20px">
        当前第<span th:text="${bookpageInfo.pageNum}"></span>页，共<span th:text="${bookpageInfo.total}"></span>条记录，共<span th:text="${bookpageInfo.pages}"></span>页
        <a th:if="${bookpageInfo.pageNum==1}" href="javascript:void(0)">上一页</a>
        <a th:if="${bookpageInfo.pageNum!=1}" th:href="@{/booklist(title=${title},author=${author},pageNum=${bookpageInfo.pageNum}-1)}">上一页</a>
        <a th:each="i:${#numbers.sequence(1,bookpageInfo.pages)}">
          <a th:href="@{/booklist(title=${title},author=${author},pageNum=${i})}" th:text="${i}"></a>
        </a>
        <a th:if="${bookpageInfo.pageNum}==${bookpageInfo.pages}" href="javascript:void(0)">下一页</a>
        <a th:if="${bookpageInfo.pageNum}!=${bookpageInfo.pages}" th:href="@{/booklist(title=${title},author=${author},pageNum=${bookpageInfo.pageNum}+1)}">下一页</a>
      </div>

      <button><a href="/bookadd" style="font-size: 15px">添加图书</a></button>
      <br>
      <a href="/login">退出系统</a>
    </div>
  </div>
</div>
</body>
</html>